<template>
  <div>
    <el-card class="box-card">
      <div slot="header" class="clearfix">
        <span style="float: left;color:blue">统计条件</span>
        <el-button type="danger" style="float:right;" @click="GetComprehensiveStatisticsContractsProjectsPoExcel()">导出excel</el-button>
      </div>
      <div>
        <tr>
          <td>生产部门</td>
          <td>
            <el-select v-model="value" placeholder="请选择">
              <el-option
                v-for="item in drop_down"
                :key="item"
                :label="item"
                :value="item"
              >
              </el-option>
            </el-select>
          </td>
          <td>年份</td>
          <td>
            <el-select v-model="year" placeholder="请选择">
              <el-option :label="2020" :value="2020"> </el-option>
              <el-option :label="2021" :value="2021"> </el-option>
              <el-option :label="2022" :value="2022"> </el-option>
              <el-option :label="2023" :value="2023"> </el-option>
              <el-option :label="2024" :value="2024"> </el-option>
            </el-select>
          </td>
          <td>季节</td>
          <td>
               <el-select  placeholder="全部">
             <el-option :label="1" :value="1"> </el-option>
              <el-option :label="2" :value="2"> </el-option>
              <el-option :label="3" :value="3"> </el-option>
              <el-option :label="4" :value="4"> </el-option>
               </el-select>
          </td>
          <td>月份</td>
          <td>
            <el-select v-model="month" placeholder="请选择">
              <el-option :label="1" :value="1"> </el-option>
              <el-option :label="2" :value="2"> </el-option>
              <el-option :label="3" :value="3"> </el-option>
              <el-option :label="4" :value="4"> </el-option>
              <el-option :label="5" :value="5"> </el-option>
              <el-option :label="6" :value="6"> </el-option>
              <el-option :label="7" :value="7"> </el-option>
              <el-option :label="8" :value="8"> </el-option>
              <el-option :label="9" :value="9"> </el-option>
              <el-option :label="10" :value="10"> </el-option>
              <el-option :label="11" :value="11"> </el-option>
              <el-option :label="12" :value="12"> </el-option>
            </el-select>
          </td>
          <td><el-button type="success" @click="GetComprehensiveStatisticsContractsProjectsPo">查询</el-button></td>
        </tr>
      </div>
      <h3 style="float: left;color:blue">统计结果</h3>
    </el-card>
    <el-tabs v-model="activeName">
      <el-tab-pane label="统计表" name="1">
         <h3> 全院部门第三季度合同信息与项目信息统计表</h3>
          <span style="float:right;color:red">单位(个)</span>
        <el-table :data="tableData" style="width: 100%">
          <el-table-column
            prop="depname"
            label="生产部门"
            width="210"
          >
          </el-table-column>
          <el-table-column prop="customer_information" label="客户信息">
          </el-table-column>
          <el-table-column prop="contract_information" label="合同信息">
          </el-table-column>
          <el-table-column prop="project_information" label="项目信息">
          </el-table-column>
          <el-table-column prop="unplanned_project" label="未策划项目">
          </el-table-column>
          <el-table-column prop="review_projects_have_been_planned" label="已经策划评审项目">
         </el-table-column>
        </el-table>
      </el-tab-pane>
      <!-- ----------------加入判断------------------------------------------------------------------------------- -->
      <el-tab-pane label="统计图表" name="2"> 
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
import {GetAllDepartment,GetComprehensiveStatisticsContractsProjectsPo ,GetComprehensiveStatisticsContractsProjectsPoExcel} from "./AttendanceManagementApi";
import moment from "moment";
export default {
  data() {
    return {
      activeName: "1",
      tableData: [],
       tableData2:[],
      drop_down:[],
      depname: null,
      year: null,
      month: null,
      quarter:null,
    };
  },
  created() {
      this.GetAllDepartment();
      this.GetComprehensiveStatisticsContractsProjectsPo();
  },
  methods: {
    GetAllDepartment(){
      GetAllDepartment().then((res)=>{
      this.drop_down=res.data;
      var a=res.data;
        //  a.forEach(r => {
        // this.depname=r;
      //   // return;
      // });

      })
    },
    GetComprehensiveStatisticsContractsProjectsPo(){
        GetComprehensiveStatisticsContractsProjectsPo(this.depname,this.year).then((res)=>{
            this.tableData=res.data;
        })
    },
    GetComprehensiveStatisticsContractsProjectsPoExcel(){
        GetComprehensiveStatisticsContractsProjectsPoExcel(this.depname,this.year).then((res)=>{
            alert(res.data);
        })
    }
  },
};
</script>